package main

import "fmt"

func f1(ch chan int) {
	for i := 0; i < 100; i++ {
		ch <- i
	}
	close(ch)
}

func f2(ch1 chan int, ch2 chan int) {
	for i := range ch1 {
		ch2 <- i * i
	}
	close(ch2)
}

func main() {
	a := make(chan int, 100)
	b := make(chan int, 200)

	go f1(a)
	go f2(a, b)

	for v := range b {
		fmt.Println(v)
	}
}
